#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdio.h>
#include <cmockery.h>

extern int open_file(char *filename);

FILE *fopen (const char *filename, const char *mode)
{
	return (FILE *)mock();
}

void test_open_file_return_succ(void **state)
{
	will_return(fopen, 0x1234);
	assert_true(open_file("foo.txt") == 0);
}

void test_open_file_return_fail(void **state)
{
	will_return(fopen, NULL);
	assert_true(open_file("foo.txt") == -1);
}

int main()
{
	const UnitTest tests[] = {
		unit_test(test_open_file_return_succ),
		unit_test(test_open_file_return_fail),
	};

	return run_tests(tests);
}
